<extend name="Layout:layout_dialog" />
<block name="body_main">
    <form action="{:U('user_role_save')}" method="post" class="xsui-form">
        <table class="xsui-table xsui-table-striped xsui-table-hover xsui-table-bordered" data-checkbox-attr='name="id[]" value=":value"'>
            <thead>
                <tr>
                    <th>标题</th>
                    <th>备注</th>
                </tr>
            </thead>
            <tbody>
            <foreach name="list" item="vo">
                <tr data-key="{$vo.id}">
                    <td>{$vo.title}</td>
                    <td>{$vo.remark}</td>
                </tr>
            </foreach>
            </tbody>
        </table>
        <button type="submit" class="ui-state-default"><i class="fa fa-save"></i>保存</button>
        <button type="reset" class="ui-state-default">重置</button>
        <input type="hidden" name="uid" value="{$uid}"/>
        <input type="hidden" name="role_ids" value="{$role_ids}"/>
    </form>
</block>
<block name="body_after">
    <script type="text/javascript">
        reset();
        // 重置表单 2016-1-14 SoChishun Added.
        function reset() {
            var ids = $('[name="role_ids"]').val().split(',');
            $(ids).each(function () {
                $(':checkbox[value="' + this + '"]').prop('checked', true);
            })
        }
    </script>
</block>